<!--
 * @Author: your name
 * @Date: 2021-02-20 15:40:39
 * @LastEditTime: 2021-02-20 15:57:09
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \demoe:\前端开发学习\hmtt\hm63-hmtt-wsh\src\views\home\my\my.vue
-->
<template>
  <div class="my">
    <!-- 头部区 -->
    <div class="top">
      <div class="photoBar">
        <div class="left">
          <div class="photoImg">
            <img
              :src="userInfo.photo"
              alt=""
              @click="$router.push('/home/my/myInfo')"
            />
          </div>
          <div class="txt">
            <div class="name">{{ userInfo.name }}</div>
            <div class="application">申请认证</div>
          </div>
        </div>
        <div class="right">
          <van-icon class="icon" name="newspaper-o" color="#fff" size="30" />
          <div class="read_item">
            <span>今日阅读</span>
            <span>5分钟</span>
          </div>
        </div>
      </div>
      <div class="dataBar">
        <div class="data_item">
          <div class="num">8</div>
          <div>动态</div>
        </div>
        <div class="data_item">
          <div class="num">{{ userInfo.follow_count }}</div>
          <div>关注</div>
        </div>
        <div class="data_item">
          <div class="num">{{ userInfo.fans_count }}</div>
          <div>粉丝</div>
        </div>
      </div>
    </div>
    <!-- 中间区 -->
    <div class="middle">
      <div class="nav">
        <div class="nav_item">
          <van-icon name="star-o" color="#eb5253" size="22" />
          <div>收藏</div>
        </div>
        <div class="nav_item">
          <van-icon name="clock-o" color="#ff9d1d" size="22" />
          <div>历史</div>
        </div>
        <div class="nav_item">
          <van-icon name="records" color="#678eff" size="22" />
          <div>作品</div>
        </div>
      </div>
      <div class="line"></div>
      <div class="info_bar">
        <span class="words">消息通知</span>
        <van-icon name="arrow" color="#9f9f9f" size="10" />
      </div>
      <div class="info_bar">
        <span class="words">实名认证</span>
        <van-icon name="arrow" color="#9f9f9f" size="10" />
      </div>
      <div class="line"></div>
      <div class="info_bar">
        <span class="words">用户反馈</span>
        <van-icon name="arrow" color="#9f9f9f" size="10" />
      </div>
      <div class="info_bar">
        <span class="words">小智同学</span>
        <van-icon name="arrow" color="#9f9f9f" size="10" />
      </div>
      <div class="info_bar">
        <span class="words">系统设置</span>
        <van-icon name="arrow" color="#9f9f9f" size="10" />
      </div>
      <div class="line"></div>
      <van-button color="#3296fa" block @click="exit">退出</van-button>
    </div>
  </div>
</template>
<script>
import { mapState, mapMutations } from 'vuex'
import { removeLocal } from '@/utils/local'
import { Dialog } from 'vant'
export default {
  created () {},
  data () {
    return {}
  },
  computed: {
    ...mapState(['userInfo'])
  },
  methods: {
    ...mapMutations(['setIsLogin']),
    exit () {
      Dialog.confirm({
        message: '是否确定退出登录?'
      })
        .then(() => {
          removeLocal('token')
          this.setIsLogin(false)
          this.$router.push('/login')
        })
        .catch(() => {
          // on cancel
        })
    }
  }
}
</script>
<style lang="less" scoped>
.my {
  .top {
    height: 200px;
    padding-top: 58px;
    // padding-bottom: 16px;
    background-color: @bg;
    .photoBar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      height: 66px;
      padding-left: 20px;
      .left {
        display: flex;
        align-items: center;
        .photoImg {
          width: 66px;
          height: 66px;
          img {
            width: 100%;
            height: 100%;
            border-radius: 50%;
          }
        }
        .txt {
          margin-left: 15px;
          .name {
            margin-bottom: 11px;
            font-family: MicrosoftYaHei;
            font-size: 15px;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 1px;
            color: #ffffff;
          }
          .application {
            width: 58px;
            line-height: 16px;
            text-align: center;
            background-color: #ffffff;
            border-radius: 5px;
            font-family: MicrosoftYaHei-Bold;
            font-size: 10px;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 1px;
            color: #3296fa;
          }
        }
      }
      .right {
        display: flex;
        align-items: center;
        padding: 8px 0px 6px 8px;
        width: 94px;
        height: 40px;
        background-color: rgba(0, 0, 0, 0.2);
        border-top-left-radius: 20px;
        border-bottom-left-radius: 20px;
        .read_item {
          margin-left: 4px;
          font-family: MicrosoftYaHei;
          font-size: 11px;
          font-weight: normal;
          font-stretch: normal;
          letter-spacing: 1px;
          color: #ffffff;
        }
      }
    }
    .dataBar {
      display: flex;
      justify-content: space-around;
      align-items: center;
      text-align: center;
      margin-top: 27px;
      margin-bottom: 16px;
      .data_item {
        font-family: ArialMT;
        font-size: 14px;
        font-weight: normal;
        font-stretch: normal;
        letter-spacing: 1px;
        color: #ffffff;
        .num {
          margin-bottom: 5px;
        }
      }
    }
  }
  .middle {
    .nav {
      display: flex;
      justify-content: space-around;
      text-align: center;
      align-items: center;
      height: 60px;
    }
    .nav_item {
      font-family: MicrosoftYaHei;
      font-size: 14px;
      font-weight: normal;
      font-stretch: normal;
      letter-spacing: 1px;
      color: #333333;
    }
    .line {
      height: 5px;
      background-color: #f5f7f9;
    }
    .info_bar {
      height: 58px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-left: 25px;
      padding-right: 15px;
      font-family: MicrosoftYaHei;
      font-size: 15px;
      font-weight: normal;
      font-stretch: normal;
      letter-spacing: 1px;
      color: #333333;
      border-bottom: 1px solid #edeff3;
    }
  }
}
</style>
